<%-- 
    Document   : carinho
    Created on : 13/10/2013, 17:16:25
    Author     : Jorley
--%>

<%@page import="java.util.Date"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core"      prefix="c"%>
<%@taglib uri="http://java.sun.com/jstl/fmt"           prefix="fmt"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <c:import url="cabecalho.jsp"/>
        
        <c:if test="${fn:trim(cliente.idCliente) != null and fn:trim(cliente.idCliente) != ''}" >
            <table 
                <tr> 
                    <td> Olá <c:out value="${cliente.nome}"/> </td>
                    <td> 
                        <% Date hoje = new Date(); %>          
                        <c:out value="<%=hoje%>"/>
                    </td>
                </tr>
        </c:if>
                <h1> Carrinho de Compras</h1>  
                
        <table style="vertical-align: top; text-align: center;" >
            <tr>
                <td style="vertical-align: top; text-align: center;"><b>Produto<br></b></td>
                <td style="vertical-align: top; text-align: center;"><b> </b></td>
                <td style="vertical-align: top; text-align: center;"><b>Quantidade</b></td>
                <td style="vertical-align: top; text-align: center;"><b>Preço</b></td>
                <td style="vertical-align: top; text-align: center;"><b>Total</b></td>
            </tr>
            
                        <c:forEach var="item" items="${carrinho.itens}">
                            <tr>
                                <td style="vertical-align: top; text-align: right;">
                                    <img width="60" height="60" alt="${item.produto.codigo}" src="resources/imagens/${item.produto.codigo}.jpg" /> 
                                </td>
                                <td  style="vertical-align: top; text-align: right;">
                                    <h2> <c:out value="${produto.nome}" /> </h2> 
                                    <br>
                                    <c:out value="${item.produto.descricao}"/>
                                </td>
                                <td  style="vertical-align: top; text-align: right;">
                                    <select name="qtd">
                                        <c:forEach begin="1" end="100" var="qtd">
                                          <option><c:out value="${qtd}"/></option>
                                        </c:forEach>
                                    </select>
                                </td>
                                <td style="vertical-align: top; text-align: right;">
                                    <br>
                                    <h3> <c:out value="R$ ${item.produto.preco}" /> </h3>
                                </td>
                                <td style="vertical-align: top; text-align: right;">
                                    <br>
                                    <h3> <c:out value="R$ ${item.produto.preco}" /> </h3>
                                </td>
                            </tr>
                        </c:forEach>
                            <tr>
                                <td></td>
                                <td></td>
                                <td>
                                    <h3> Total </h3>
                                </td>
                                <td>
                                    <h2><c:out value="R$ ${carrinho.valorTotal}"/> </h2>
                                </td>
                            </tr>
            
        </table>     
                        
        <c:import url="rodape.jsp"/>
    </body>
</html>
